package com.isorf.mapper;

import com.isorf.pojo.adv;
import com.isorf.pojo.links;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface advmapper {

    @Insert("INSERT INTO adv (companyname, adcost, advalidity, adexternalurl, adimage) VALUES (#{companyname}, #{adcost}, #{advalidity}, #{adexternalurl}, #{adimage})")
    int addadv(adv adv);

    @Select("SELECT id, companyname, adcost, advalidity, adexternalurl, adimage FROM adv ORDER BY id DESC")
    List<adv> pageList();

    @Delete("DELETE FROM adv WHERE id=#{id}")
    int deleteadv(Integer id);

    @Delete({
            "<script>",
            "DELETE FROM adv WHERE id IN",
            "<foreach collection='list' item='id' open='(' separator=',' close=')'>",
            "#{id}",
            "</foreach>",
            "</script>"
    })
    int batchDelete(List<Integer> id);






}
